-
Notifications
You must be signed in to change notification settings - Fork 144
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make anyio.run_process()
accept stdin
argument
#859
Make anyio.run_process()
accept stdin
argument
#859
Conversation
This is consistent with what `asyncio.create_subprocess_exec()`, `trio.run_process()`, and `subprocess.run()`, which accept such an argument. The handling of conflicts between `stdin` and `input` arguments is simplistic: the latter overrides the former without warning.
This new unit test may be able to replace the previously existing `test_run_process_connect_to_file` test, as `run_process()` internally just delegates to `open_process()`, so both are proven working by the new test.
59c708d
to
0452d94
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. I'll just ask around if anyone has any objections.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The handling of conflicts between stdin and input arguments is simplistic: the latter currently overrides the former without warning.
this feels like an unnecessary footgun with ~zero upside, I think you should add an
if stdin is not None and input is not None:
raise ValueError("only one of stdin and input is allowed"
How do the upstream APIs handle it when both are passed? |
Oh, right, this is an AnyIO only thing that we have. Never mind. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! Just a missing test case for coverage
if stdin is not None and input is not None: | ||
raise ValueError("only one of stdin and input is allowed") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you probably want a test case for this.
(maybe look over coverage config to enforce 100% patch coverage?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Path coverage minimum set to 100% on Coveralls. Test case added.
Changes
Make
anyio.run_process()
accept astdin
argument.This is consistent with what
asyncio.create_subprocess_exec()
,trio.run_process()
, andsubprocess.run()
, which accept such an argument.The handling of conflicts between
stdin
andinput
arguments is simplistic: the latter currently overrides the former without warning.Checklist
tests/
) added which would fail without your patchdocs/
, in case of behavior changes or newfeatures)
docs/versionhistory.rst
).